package main;

import book.BookList;
import user.Admin;
import user.NormalUser;
import user.User;

import java.util.Scanner;

public class Main {
    public static User login(){
        Scanner in=new Scanner(System.in);
        System.out.println("请输入你的姓名:");
        String name=in.nextLine();
        System.out.println("请选择自己的身份：0.管理员 1.普通用户");
        int choice=in.nextInt();
        if(choice==0){
            return new Admin(name);
        }
        else{
            return new NormalUser(name);
        }
    }
    public static void main(String[] args) {
        User user=login();
        BookList bookList=new BookList();
        while (true){
            int choice=user.menu();
            user.doOperation(choice,bookList);
        }
    }
}
